﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="nav_config.aspx.cs" Inherits="YULI.Web.admin.settings.nav_config" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>后台导航</title>
    <link href="../css/shop.css" type="text/css" rel="stylesheet" />
    <link href="/css/Sellerber.css" type="text/css" rel="stylesheet" />
    <link href="../css/bkg_ui.css" type="text/css" rel="stylesheet" />
    <link href="../font/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
    <script src="/scripts/jquery/jquery-1.9.1.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="/scripts/jquery/jquery.cookie.js"></script>
    <script src="../js/shopFrame.js" type="text/javascript"></script>
    <script src="/scripts/jquery/Sellerber.js" type="text/javascript"></script>
    <script src="/scripts/layer/layer.js" type="text/javascript"></script>
    <script src="/scripts/laydate/laydate.js" type="text/javascript"></script>
    <script src="/scripts/jquery/hsCheckData.js" type="text/javascript"></script>
    <script src="../js/common/function.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            //提交表单
            $("#btnSubmit").bind("click", function () {
                if ($("#selCategory").val() == "") {
                    layer.alert('请选择上级导航！', {
                        title: '提示框',
                        icon: 0,
                    });
                    return false;
                }
                if ($("#txtTitle").val() == "") {
                    layer.alert('请填写栏目名称！', {
                        title: '提示框',
                        icon: 0,
                    });
                    return false;
                }
                if ($("#txtCallIndex").val() == "") {
                    layer.alert('请填写调用别名！', {
                        title: '提示框',
                        icon: 0,
                    });
                    return false;
                }
                //if ($("#txtLinkUrl").val() == "") {
                //    layer.alert('请填写链接地址！', {
                //        title: '提示框',
                //        icon: 0,
                //    });
                //    return false;
                //}
                $.ajax({
                    type: "POST",
                    url: $("#form1").attr("url"),
                    dataType: "json",
                    data: {
                        "hidNavID": $("#hidNavID").val(),
                        "selCategory": $("#selCategory").val(),
                        "txtTitle": $("#txtTitle").val(),
                        "txtCallIndex": $("#txtCallIndex").val(),
                        "txtIconUrl": $("#txtIconUrl").val(),
                        "txtLinkUrl": $("#txtLinkUrl").val(),
                        "txtSortID": $("#txtSortID").val(),
                        "rdoIsShow": $("#rdoIsShow").val(),
                        "txtRemark": $("#txtRemark").val()
                    },
                    timeout: 20000,
                    beforeSend: function (XMLHttpRequest) {
                        $("#btnSubmit").attr("disabled", true);
                    },
                    success: function (data, textStatus) {
                        if (data.status == 1) {
                            layer.alert(data.info, function (index) {
                                location.href = data.url;
                            });
                        } else {
                            $("#btnSubmit").attr("disabled", false);
                            layer.alert(data.info, {
                                title: '提示框',
                                icon: 0,
                            });
                        }
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        layer.alert('状态：' + textStatus + '；出错提示：' + errorThrown, {
                            title: '提示框',
                            icon: 0,
                        });
                        $("#btnSubmit").attr("disabled", false);
                    }
                });
                return false;
            });
        });
    </script>
</head>
<body class="label-hui">
    <div class="margin clearfix" id="page_style">
        <div class="columns_list_style  clearfix inherit" id="Sellerber">
            <div class="Sellerber_left menu" id="menuBar">
                <div class="show_btn" id="rightArrow"><span></span></div>
                <div class="side_title"><a title="隐藏" class="close_btn"><span></span></a></div>
                <div class="menu_style" id="menu_style">
                    <div class="list_content">
                        <div class="side_list">
                            <div class="column_title">
                                <h4 class="lighter smaller">系统栏目设置</h4>
                            </div>
                            <form id="form1" name="form1" url="/tools/admin_ajax.ashx?action=edit_nav">
                                <div class="Column_editing padding15">
                                    <ul class="add_style">
                                        <li class="clearfix mb15">
                                            <label class="label_name col-xs-3 col-sm-3">上级导航：</label><span class="Column_name col-xs-9">
                                                <select id="selCategory" name="selCategory" class="col-xs-8 col-sm-8 fl_hsCheckData">
                                                    <%if (this.nav_id == 0)
                                                        {%>
                                                    <%=NavBind(0)%>
                                                    <%}
                                                        else
                                                        {%>
                                                    <%=NavBind(model.parent_id)%>
                                                    <%}%>
                                                </select></span>
                                        </li>
                                        <li class="clearfix mb15">
                                            <label class="label_name col-xs-3 col-sm-3">栏目名称：</label>
                                            <span class="Column_name col-xs-9">
                                                <input type="text" id="txtTitle" name="txtTitle" class="col-xs-8 col-sm-8" value="<%=model.title%>" />
                                                <input type="hidden" id="hidNavID" name="hidNavID" value="<%=model.id%>" />
                                            </span>
                                        </li>
                                        <li class="clearfix mb15">
                                            <label class="label_name col-xs-3 col-sm-3">调用别名：</label>
                                            <span class="Column_name col-xs-9">
                                                <input type="text" id="txtCallIndex" name="txtCallIndex" class="col-xs-8 col-sm-8" value="<%=model.name%>" /></span>
                                        </li>
                                        <li class="clearfix mb15">
                                            <label class="label_name col-xs-3 col-sm-3">自定义图标：</label>
                                            <span class="Column_name col-xs-9">
                                                <input type="text" id="txtIconUrl" name="txtIconUrl" class="col-xs-8 col-sm-8" value="<%=model.icon_url%>" /></span>
                                        </li>
                                        <li class="clearfix mb15">
                                            <label class="label_name col-xs-3 col-sm-3">链接地址：</label>
                                            <span class="Column_name col-xs-9">
                                                <input type="text" id="txtLinkUrl" name="txtLinkUrl" class="col-xs-10 col-sm-10" value="<%=model.link_url%>" /></span>
                                        </li>
                                        <li class="clearfix mb15">
                                            <label class="label_name col-xs-3 col-sm-3">排序：</label>
                                            <span class="Column_name col-xs-9">
                                                <input type="text" id="txtSortID" name="txtSortID" class="col-xs-4 col-sm-4" value="<%=model.sort_id%>" onkeydown="return checkNumber(event);" /></span>
                                        </li>
                                        <li class="clearfix mb15">
                                            <label class="label_name col-xs-3 col-sm-3">状态：</label>
                                            <span class="Column_name col-xs-9">
                                                <%if (model.is_lock == 0)
                                                    {%>
                                                <div class="Add_content col-xs-9">
                                                    <label>
                                                        <input name="rdoIsShow" type="radio" checked="checked" class="ace" value="0" /><span class="lbl">显示</span></label>&nbsp;&nbsp;&nbsp;
     <label>
         <input name="rdoIsShow" type="radio" class="ace" value="1" /><span class="lbl">隐藏</span></label>
                                                </div>
                                                <%}
                                                    else
                                                    {%>
                                                <div class="Add_content col-xs-9">
                                                    <label>
                                                        <input name="rdoIsShow" type="radio" class="ace" value="0" /><span class="lbl">显示</span></label>&nbsp;&nbsp;&nbsp;
     <label>
         <input name="rdoIsShow" type="radio" checked="checked" class="ace" value="1" /><span class="lbl">隐藏</span></label>
                                                </div>
                                                <%}%>
                                            </span>
                                        </li>
                                        <li class="clearfix mb15">
                                            <label class="label_name col-xs-3 col-sm-3">备注说明：</label>
                                            <span class="Column_name col-xs-9">
                                                <textarea class="form-control col-xs-10 col-sm-10" id="txtRemark" name="txtRemark" onkeyup="checkLength(this);"><%=model.remark%></textarea>
                                                <span class="wordage block l_f">剩余字数：<span id="sy" style="color: Red;">200</span>字</span>
                                            </span>
                                        </li>
                                        <li class="clearfix mb15 align">
                                            <button type="button" class="btn button_btn bg-deep-blue" id="btnSubmit" name="btnSubmit">添加导航</button>
                                        </li>
                                    </ul>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
            <!--数据展示-->
            <div class="list_show inherit">
                <div class="Column_display confirm detailed_style">
                    <div class="title_name" style="color:white;">栏目菜单功能区块展示设置</div>
                    <div class="menu_Settings clearfix padding15">
                        <%for (int i = 0; i < NavList(0).Rows.Count; i++)
                            {%>
                        <ul class="menu_operation" id="div<%=NavList(0).Rows[i]["id"].ToString()%>">
                            <li class="menu_title" style="color:white;"><%=NavList(0).Rows[i]["title"].ToString()%></li>
                            <%for (int j = 0; j < NavList(Convert.ToInt32(NavList(0).Rows[i]["id"])).Rows.Count; j++)
                                {%>
                            <li><a href="nav_config.aspx?nav_id=<%=NavList(Convert.ToInt32(NavList(0).Rows[i]["id"])).Rows[i]["id"].ToString()%>" style="cursor:pointer;"><%=NavList(Convert.ToInt32(NavList(0).Rows[i]["id"])).Rows[i]["title"].ToString()%></a></li>
                            <%}%>
                        </ul>
                        <%}%>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
<script type="text/javascript">
    //设置内页框架布局
    $(function () {
        $("#Sellerber").frame({
            float: 'left',
            color_btn: '.skin_select',
            Sellerber_menu: '.list_content',
            page_content: '.list_show',//内容
            datalist: ".menu_Settings",//数据列表高度取值
            mwidth: 400,//菜单栏宽度
            minStatue: true,
            drag: false,//是否启用拖拽功能水平拖拽
            dragclass: ".menu_operation",//选择移动参数
        });
    });

    /*字数限制*/
    function checkLength(which) {
        var maxChars = 200; //
        if (which.value.length > maxChars) {
            layer.open({
                icon: 2,
                title: '提示框',
                content: '您输入的字数超过限制!',
            });
            // 超过限制的字数了就将 文本框中的内容按规定的字数 截取
            which.value = which.value.substring(0, maxChars);
            return false;
        } else {
            var curr = maxChars - which.value.length; //250 减去 当前输入的
            document.getElementById("sy").innerHTML = curr.toString();
            return true;
        }
    };
</script>
